package com.moss.cloud.remote.api.rpc;

import com.moss.cloud.common.core.model.Result;
import com.moss.cloud.remote.api.model.from.IPAddrFrom;
import com.moss.cloud.remote.api.model.from.WXUserInfoFrom;
import com.moss.cloud.remote.api.model.from.WXUserTokenFrom;
import com.moss.cloud.remote.api.model.vo.IPAddrVO;
import com.moss.cloud.remote.api.model.vo.WXCodeAccessToken;
import com.moss.cloud.remote.api.model.vo.WXUserInfo;
import com.moss.cloud.remote.api.model.vo.WXUserJSCode;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@Component
@FeignClient(value = "moss-cloud-remote", contextId = "RemoteRpcService")
public interface RemoteRpcService {
    /**
     * 用CODE换取access_token
     *
     * @param wxUserTokenFrom
     * @return
     */
    @PostMapping("/doUserToken")
    Result<WXCodeAccessToken> doGetToken(@RequestBody WXUserTokenFrom wxUserTokenFrom);

    /**
     * 用accessToken和openid获取用户信息
     *
     * @param wxUserInfoFrom
     * @return
     */
    @PostMapping("/doUserInfo")
    Result<WXUserInfo> doGetUserInfo(@RequestBody WXUserInfoFrom wxUserInfoFrom);

    /**
     * JS_CODE获取openid
     *
     * @param wxUserTokenFrom
     * @return
     */
    @PostMapping("/remote/wx/doOpenId")
    Result<WXUserJSCode> doOpenId(@RequestBody WXUserTokenFrom wxUserTokenFrom);
    /**
     * 获取IP地址信息
     *
     * @param from
     * @return
     */
    @PostMapping("/remote/ip/getIpAddr")
    Result<IPAddrVO> getIpAddr(@RequestBody IPAddrFrom from);

}
